//
//  TSSTImageView.m
//  SimpleComic
//
//  Created by Alexander Rauchfuss on 7/15/07.
//  Copyright 2007 Dancing Tortoise Software. All rights reserved.
//

#import "TSSTImageView.h"
#import "TSSTImageUtilities.h"

@implementation TSSTImageView

- (id) init
{
    self = [super init];
    if (self != nil) {
        clears = NO;
    }
    return self;
}

- (void)setClears:(BOOL)canClear
{
    clears = canClear;
}

- (BOOL)clears
{
    return clears;
}


- (void)drawRect:(NSRect)rect
{
    
    if(clears)
    {
        [[NSColor clearColor] set];
        NSRectFill( [self bounds]);
    }
    
    [NSGraphicsContext saveGraphicsState];
    [[NSGraphicsContext currentContext] setImageInterpolation: NSImageInterpolationHigh];
    [[self image] drawInRect: rectWithSizeCenteredInRect([[self image] size], [self bounds]) 
					fromRect: NSZeroRect 
				   operation: NSCompositeSourceOver 
					fraction: 1];
    [NSGraphicsContext restoreGraphicsState];
}

@end
